package ms.unicorn.modellanguage;

import ms.unicorn.Element;

import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;

public interface IModelLanguage {
	
	String getId();
	
	void setId(String langId);
	
	/**
	 * Get the name of the modeling language
	 * @return name of modeling language 
	 */
	String getName();
	
	void setName(String languageName);
	
	/**
	 * Return the creation command for an language element
	 * @param element A language element that is needed to create
	 * @param req The create element request
	 */
	//@Deprecated
	//ICommand getCreationCommand(LanguageElement element, CreateElementRequest req);
	
	/**
	 * Initialize settings for a new element of the language.
	 * @param element The new element to be initialized
	 * @param request A configure request object containing context information for configuration
	 */
	void configElement(Element element, ConfigureRequest request);
	
	/**
	 * Create view for a language element
	 * @param IAdaptable (for semantic element)
	 * @param containerView the container view that will contain the created view.
	 * @param indicates the type of the view, it could be used later to determine the view type
	 * @param index position in the container view's list of children views.
	 * @param persisted indicates if the created view will be persisted or not
	 * @param preferencesHint
	 *            The preference hint that is to be used to find the appropriate
	 *            preference store from which to retrieve diagram preference
	 *            values. The preference hint is mapped to a preference store in
	 *            the preference registry <@link DiagramPreferencesRegistry>.
	 * @return the created <code>Node</code>
	 */
	//@Deprecated
	/*View createView(LanguageElement element, IAdaptable semanticAdapter, View containerView,
			String semanticHint, int index, boolean persisted,
			PreferencesHint preferencesHint);*/
	
	/**
	 * Create a graphical edit part for an element
	 * @param context The element that needs an edit part.
	 * @return An <code>org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart</code>
	 *  for the given element.
	 */
	//IGraphicalEditPart createEditPart(EditPart context, View view);
	
	/**
	 * Create a figure for a element.
	 * @param context TODO
	 * @param element The element that needs a figure.
	 * @param editPart The edit part of the given element.
	 * @return An <code>org.eclipse.draw2d.IFigure</code> object for the given element.
	 */
	/*@Deprecated
	Map<String, IFigure> createFigures(EditPart context, Element element, EditPart editPart);*/
	
	/**
	 * Get the number of elements supported by this language.
	 * @return An integer number indicates total elements.
	 */
	int getElementCount();
	
	/**
	 * Add a new element supported by this language.
	 * @param element The new element.
	 */
	void addElement(LanguageElement element);
	
	/**
	 * Get a language element by index. 
	 * @param idx The index of the element to get.
	 * @return The <code>ILanguageElement</code> at the given index.
	 */
	LanguageElement getElement(int idx);
	
	/**
	 * Get a language element by id (or element type).
	 * @param id The id (or type name) of the element to get. 
	 * @return The <code>ILanguageElement</code> whose id equals to the give id.
	 */
	LanguageElement getElement(String id);
	
	/**
	 * Remove an element from the language.
	 * @param id The id (or type name) of the element to be removed.
	 */
	void removeElement(String id);

	void registerElementTypes();

	Object getCachedObject(String typeName);

	void setCachedObject(Object object);

	/*@Deprecated
	EditPolicy createPrimaryDragEditPolicy(Element element, EditPart editPart);*/

}
